#include <cstdio>
#include <cstring>

struct Trie
{
    Trie *next[ 10 ];
    int count;
    Trie( )
    {
        int i;
        for ( i = 0; i < 10; i++ )
            next[ i ] = NULL;
        count = 0;
    }
};

int n;

void work( )
{
    Trie *head = new Trie, *p;
    int s, max = 0;
    char data[ 31 ];
    gets( data );
    while ( n-- )
    {
        gets( data );
        s = 0;
        p = head;
        while ( data[ s + 1 ] != '\0' && data[ s ] == '0' )
            s++;
        while ( data[ s ] != '\0' )
        {
            if ( !p->next[ data[ s ] - '0' ] )
                p->next[ data[ s ] - '0' ] = new Trie;
            p = p->next[ data[ s ] - '0' ];
            s++;
        }
        p->count++;
        if ( max < p->count )
            max++;
    }
    printf("%d\n", max);
}

int main( )
{
    while ( scanf("%d", &n) != EOF )
        work( );
    return 0;
}
